package com.sikaryofficial.common.core.utils.file;

/**
 * 媒体类型工具类
 * 
 * @author ruoyi
 */
public class MimeTypeUtils
{
    public static final String IMAGE_PNG = "image/png";

    public static final String IMAGE_JPG = "image/jpg";

    public static final String IMAGE_JPEG = "image/jpeg";

    public static final String IMAGE_BMP = "image/bmp";

    public static final String IMAGE_GIF = "image/gif";

    public static final String VIDEO_MP4 = "video/mp4";

    public static final String TS = "ts";

    public static final String OGG = "ogg";

    public static final String M3U8 = "m3u8";

    public static final String PNG = "png";

    public static final String JPG = "jpg";

    public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" , "jfif"};

    public static final String[] COMPRESS_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };

    public static final String[] FLASH_EXTENSION = { "swf", "flv" };

    public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
            "asf", "rm", "rmvb" };

    public static final String[] AUDIO_EXTENSION = { "mp3", "wav", "wma", "acc", "flac", "ogg", "alac", "dsd"};

    public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "mov", "mpg", "flv", "wmv"};

    public static final String[] DEFAULT_ALLOWED_EXTENSION = {
            // 图片-额外增加一种图片格式
            "bmp", "gif", "jpg", "jpeg", "png", "jfif",
            // word excel powerpoint
            "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
            // 压缩文件
            "rar", "zip", "gz", "bz2",
            // 视频格式
            "mp4", "avi", "mov", "mpg", "flv", "wmv",
            // 音频格式
            "mp3", "wav", "wma", "acc", "flac", "ogg", "alac", "dsd",
            // pdf
            "pdf" };

    public static final String[] REGISTER_ALLOWED_EXTENSION = {
            // 图片-额外增加一种图片格式
            "jpg", "jpeg", "png",
            // pdf
            "pdf" };

    /**
     * AAC (Advanced Audio Coding): 这是一种高效的音频压缩格式，被广泛应用于Apple的设备和服务中，如iTunes和Apple Music。
     * FLAC (Free Lossless Audio Codec): 一种无损压缩格式，意味着它能够保留原始音频文件的所有细节，同时减小文件大小。
     * OGG: 通常指的是 Ogg Vorbis，这是一种开放且免费的音频编解码器，提供高质量的音效和较小的文件大小。
     * ALAC (Apple Lossless Audio Codec): 苹果公司的一种无损音频编解码器，适用于需要无损音质的应用场景。
     * DSD (Direct Stream Digital): 一种高分辨率音频格式，主要用于SACD（超级音频CD）和其他高端音频应用。
     */

    public static final String[] DEFAULT_ALLOWED_VIDEO_EXTENSION = {
            // 视频格式
            "mp4", "avi", "mov", "mpg", "flv", "wmv"
    };

    public static String getExtension(String prefix)
    {
        switch (prefix)
        {
            case IMAGE_PNG:
                return "png";
            case IMAGE_JPG:
                return "jpg";
            case IMAGE_JPEG:
                return "jpeg";
            case IMAGE_BMP:
                return "bmp";
            case IMAGE_GIF:
                return "gif";
            case VIDEO_MP4:
                return "mp4";
            default:
                return "";
        }
    }
}
